let currentPlayer = 1; // 1 表示黑子，2 表示白子

const cells = document.querySelectorAll('.cell');
const moveForm = document.getElementById('moveForm');
const xInput = document.getElementById('x');
const yInput = document.getElementById('y');
const playerInput = document.getElementById('player');

cells.forEach(cell => {
    cell.addEventListener('click', function () {
        const x = parseInt(this.dataset.x);
        const y = parseInt(this.dataset.y);

        xInput.value = x;
        yInput.value = y;
        playerInput.value = currentPlayer;

        moveForm.submit();

        // 切换玩家
        currentPlayer = currentPlayer === 1 ? 2 : 1;
    });
});